package com.active.hackson.app.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class BaseService extends HibernateDaoSupport {

  public <T> T get( Class<T> entityClass, Serializable id ) {
    return getHibernateTemplate().get( entityClass, id );
  }

  public <T> T load( Class<T> entityClass, Serializable id ) {
    return getHibernateTemplate().load( entityClass, id );
  }

  public <T> List<T> loadAll( final Class<T> entityClass ) {
    return getHibernateTemplate().loadAll( entityClass );
  }

  public Serializable save( final Object entity ) {
    return getHibernateTemplate().save( entity );
  }

  public void update( Object entity ) {
    getHibernateTemplate().update( entity );
  }

  public void saveOrUpdate( final Object entity ) {
    getHibernateTemplate().saveOrUpdate( entity );
  }

  public void saveOrUpdateAll( final Collection entities ) {
    getHibernateTemplate().saveOrUpdateAll( entities );
  }

  public void delete( Object entity ) {
    getHibernateTemplate().delete( entity );
  }

  public void deleteAll( final Collection entities ) {
    getHibernateTemplate().deleteAll( entities );
  }

  public List find( String queryString ) {
    return getHibernateTemplate().find( queryString );
  }

  public List findByExample( Object exampleEntity ) {
    return getHibernateTemplate().findByExample( exampleEntity );
  }

  public void setMySessionFactory( SessionFactory sessionFactory ) {
    super.setSessionFactory( sessionFactory );
  }


}
